package cn.wgx.module.mind.web;

import cn.wgx.common.base.IBaseController;
import cn.wgx.common.entity.mind.ProjectRole;
import cn.wgx.common.util.ResponseDataUtil;
import cn.wgx.module.mind.entity.mapper.ProjectRoleMapper;
import cn.wgx.module.mind.service.ProjectRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(tags = "01.1 项目角色")
@RestController
@RefreshScope
@RequestMapping("/api/mind/projectRole")
public class ProjectRoleCtrl extends IBaseController<ProjectRoleService, ProjectRole> {



    @ApiOperation(value = "修改角色权限, 目前只用到look和modify. ")
    @PatchMapping("updateStatus")
    public Map updateStatus(@RequestBody ProjectRole projectRole){
        if(projectRole.getPr_id() == null){
            ResponseDataUtil.returnErrorMap("pr_id不能为空");
        }
        if(projectRole.getP_look() == null || projectRole.getP_modify() == null){
            ResponseDataUtil.returnErrorMap("p_look或p_modify至少有一个");
        }
        boolean b = service.updateById(projectRole);
        return ResponseDataUtil.returnData(b);
    }

}
